package com.lantu.wisdom.controller;


import com.itextpdf.text.Document;
import com.itextpdf.text.pdf.PdfWriter;
import com.lantu.framework.common.utils.ResponseWrapper;
import com.lantu.wisdom.common.utils.CreateCodeUtil;
import com.lantu.wisdom.dto.AnswerDTO;
import com.lantu.wisdom.dto.PlaceOrderDTO;
import com.lantu.wisdom.pdf.CreatePdfUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.net.URLEncoder;

@Slf4j
@Controller
@RequestMapping("/pdf")
@Api(tags = {"生成pdf"})
public class PdfController  {



    @ApiOperation(value = "生成pdf")
    @RequestMapping(value = "/createPdf", method = RequestMethod.GET)
    @ResponseBody
    public ResponseWrapper placeOrder(HttpServletResponse response,AnswerDTO answerDTO) throws Exception {
        CreatePdfUtils.createPdf(answerDTO);

        return ResponseWrapper.success();

    }

}
